package cn.nbt.busManage.model.dto;

import cn.nbt.busManage.model.entity.Point;
import cn.nbt.busManage.model.vo.PointVo;
import jakarta.persistence.Column;
import lombok.Data;

/**
 * {@code @Author} lyq
 * {@code @Date} 6/11/2024 5:08 PM
 */
@Data
public class PointDto {
    private Integer id;
    private String pointName;
    private String latitude;
    private String longitude;
    public PointDto(Point point){
        this.id = point.getId();
        this.pointName = point.getPointName();
        String latitudeLongitude = point.getLatitudeLongitude();
        latitudeLongitude = latitudeLongitude.replace("[","");
        latitudeLongitude = latitudeLongitude.replace("]","");
        String[] split = latitudeLongitude.split(",");
        this.latitude = split[0];
        this.longitude = split[1];
    }
    public PointDto(PointVo pointVo){
        this.id = pointVo.getId();
        this.pointName = pointVo.getPointName();
        this.latitude = pointVo.getLatitude();
        this.longitude = pointVo.getLongitude();
    }
}
